<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>管理中心 - 商品列表</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/Public/Admin/Styles/general.css" rel="stylesheet" type="text/css" />
    <link href="/Public/Admin/Styles/main.css" rel="stylesheet" type="text/css" />
    <link href="/Public/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="/Public/bootstrap/css/docs.min.css" rel="stylesheet">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="/Public/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<h1>
    <?php if($_page_btn_name): ?>
    <span class="action-span"><a href="<?php echo $_page_btn_link; ?>"><?php echo $_page_btn_name; ?></a></span>
    <?php endif; ?>
<span class="action-span1"><a href="<?php echo U('');?>">管理中心</a></span>
<span id="search_id" class="action-span1"> - <?php echo $_page_title; ?> </span>
<div style="clear:both"></div>
</h1>

<!-- 列表 -->
<div class="list-div" id="listDiv">
<form action="/index.php/Admin/Goods/good_number.html?id=1" method="post" class="form-inline">
	<table cellpadding="3" cellspacing="1" class="table table-hover">
		<thead style="background-color: skyblue;">
			<tr>
				<?php if(is_array($gaData)): foreach($gaData as $k=>$v): ?><th ><?php echo ($k); ?></th><?php endforeach; endif; ?>
				<th width="120">库存量</th>
				<th width="60">操作</th>
			</tr>
				</thead>
			<tbody>
					<?php if($gnData): ?>
					<?php foreach($gnData as $k0 => $v0):?>
					<tr>
						<?php $gnCount = count($gaData)?>
						<?php foreach($gaData as $k => $v): ?>
							<td>
								<select name="goods_attr_id[]">
									<option value="">请选择...</option>
										<?php foreach($v as $k1 => $v1): $_attr = explode(',',$v0['goods_attr_id']); if(in_array($v1['id'],$_attr)) $select = 'selected =" selected "'; else $select =""; ?>
										<option <?php echo $select?> value="<?php echo $v1['id']?>"><?php echo $v1['attr_value']; ?></option>
									<?php endforeach?>
								</select>
							</td>
						<?php endforeach ?>
						<td><input name="goods_number[]" type="text" value="<?php echo ($v0["goods_number"]); ?>"/></td>
						<td><input class="form-control" type="button"  value="+" onclick="addNewTr(this);"/></td>
					</tr>
					<?php endforeach?>
					<?php else: ?>
					<tr>
						<?php $gnCount = count($gaData)?>
						<?php foreach($gaData as $k => $v): ?>
						<td>
							<select name="goods_attr_id[]">
								<option value="">请选择...</option>
								<?php foreach($v as $k1 => $v1): ?>
								<option value="<?php echo $v1['id']?>"><?php echo $v1['attr_value']; ?></option>
								<?php endforeach?>
							</select>
						</td>
						<?php endforeach ?>
						<td><input name="goods_number[]" type="text" value=""/></td>
						<td><input class="form-control" type="button"  value="+" onclick="addNewTr(this);"/></td>
					</tr>
					<?php endif?>
				<tr id="submit">
					<td align="center" colspan="<?php echo $gnCount+2; ?>">
					<input value="提交" type="submit"/>
					</td>
				</tr>
		</tbody>
	</table>
</form>
</div>
<script>
	function addNewTr( btn ) {
		var tr = $( btn ).parent().parent();
		if( $( btn ).val() == '+' ){
			var new_tr = tr.clone();
			new_tr.find( ':button' ).val( '-' );
			tr.after( new_tr );
		}else{
			tr.remove();
		}
	}
</script>

<script src="/Public/Admin/Js/tron.js"></script>
<div id="footer">
    共执行 9 个查询，用时 0.025161 秒，Gzip 已禁用，内存占用 3.258 MB<br />
    版权所有 &copy; 2005-2012 上海商派网络科技有限公司，并保留所有权利。
</div>
</body>
</html>